package com.ygqh.baby.service;

import com.ygqh.baby.ao.*;
import com.ygqh.baby.po.YgAgent;
import com.ygqh.baby.po.YgUser;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface YgAgentService {

	List<YgAgent> find();

	int findCount();

	YgAgent findById(Long id);

	int deleteSoft(Long[] ids);

	int deleteSoft(Long id);

	int save(YgAgent ygAgent);

	int update(YgAgent ygAgent);

	int saveOrUpdate(YgAgent ygAgent);

	int updateCheckStatus(Long id, CheckStatus checkStatus, String rejectReason, String checkBy, Date checkTime);

	/**
	 * 获取已通过的信息
	 * @param userId
	 * @param userType
	 * @return
	 */
	YgAgent findByUserIdAndPass(Long userId, UserType userType);

	YgAgent findAgentInfo(Long id);

	/**
	 * 验证用户是否有代理资格
	 * @param userId
	 * @return
	 */
	boolean validateAgentStatus(Long userId);

	/**
	 * 设置团长
	 * @param userId	被操作用户id
	 * @param createBy	操作用户
	 * @return
	 */
	Message saveGroupHead(Long userId, String createBy);

	/**
	 * 取消团长/代理
	 * @param userId	被操作用户id
	 * @param cancelBy	操作用户
	 * @param userType	类型（团长/代理）
	 * @return
	 */
	@Deprecated
	Message createCancelJob(Long userId, String cancelBy, UserType userType);

	/**
	 * 获取最新的信息
	 * @param userId
	 * @param userType
	 * @return
	 */
	YgAgent findByRecent(Long userId, UserType userType);

	/**
	 * 执行资格取消
	 * @param agentId
	 * @param cancelBy
	 */
	void cancelAgent(Long agentId, String cancelBy);

	/**
	 * 删除资格取消进程
	 * @param userId
	 * @param updateBy
	 * @return
	 */
	Message deleteCancelOperation(Long userId, String updateBy);

	ResultSet<YgAgent> search(QueryInfo queryInfo, String nickName, String userName, CheckStatus checkStatus, Date startDate, Date endDate, Date orderStartDate,
			Date orderEndDate);

	List<YgAgent> findAgentByTime(Date startDate, Date endDate, CheckStatus checkStatus);
	
	List<YgAgent> findByCheckStatus(List<String> checkStatus);

	YgAgent findValidByUserId(Long userId, UserType userType);

	ResultSet<Map<String,Object>> searchUserAgentReport(QueryInfo queryInfo);

    void rechargeUserAgent(YgUser user, String handler, String platformNo);

    Message cancelUserAgent(Long userId, String handler, UserType userType, String remark, BigDecimal refundPrice);

    List<YgAgent> findByLevelId(Long levelId);
}
